<template>
	<view>
		<view class="main-basic-box" v-for="item in list" :key="item.id" v-if="list.length>0">
			<view class="tab-name">{{item.name}}</view>
			<view class="" v-for="(it,i) in item.articles" :key="it.id">
				<van-cell :title="it.title" is-link :border="i<item.articles.length-1" @click="toDetail(it.id)" />
			</view>

			<!-- <van-cell title="主要考证人员是那些？" is-link />
			<van-cell title="特种作业操作证政府文件" is-link />
			<van-cell title="考证培训周期" :border="false" is-link /> -->
		</view>

		<view class="main-no-data" style="padding: 50% 0;" v-else>
			<image src="/static/empty_img.png" mode="widthFix"></image>
			<view class="">暂无文档</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			};
		},
		onLoad(e) {
			console.log('eee', e)
			if (e.pid) {
				this.getDoc(e.pid)
			}
		},
		methods: {
			// 获取项目文档
			getDoc(id) {
				this.$api.requst(`/gwc/projects/${id}/document`, {
					id: id
				}).then((res) => {
					this.list = res.data
				})
			},
			toDetail(id) {
				uni.navigateTo({
					url: '/pages/workbench/projectDoc/docDetail/docDetail?id=' + id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.main-basic-box {
		padding-bottom: 0;
	}

	.tab-name {
		font-weight: bold;
		font-size: 40rpx;
		color: #333333;
	}

	::v-deep .van-cell {
		padding: 30rpx 0 !important;
	}

	::v-deep .van-cell:after {
		left: 0 !important;
		right: 0 !important;
	}

	::v-deep .van-cell__title {
		font-size: 30rpx;
		color: #333333;
	}
</style>